package io.renren;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class Run {
    
    public static void main(String[] args){
        testSort();
    }


    public void testLoop(){
        int clit = 0;
        int cmid = 0;
        int cbig = 0;
        Long beginTime = new Date().getTime();
        for(int j = 0;j < 10000; j ++){
            List<Integer> lit = new ArrayList<Integer>();
            List<Integer> mid = new ArrayList<Integer>();
            List<Integer> big = new ArrayList<Integer>();
            for (int i = 0; i < 10000;i++){
                Integer a = (int)(Math.random() * 100 + 1);
                if(a < 34)
                    lit.add(a);
                else if(a < 67)
                    mid.add(a);
                else if(a < 100)
                    big.add(a);
            }

            int maxSize = 0;
            maxSize = lit.size() > mid.size() ? lit.size() : mid.size();
            maxSize = big.size() > maxSize ? big.size() : maxSize;
            if(lit.size() == maxSize)
                clit += 1;
            if(mid.size() == maxSize)
                cmid += 1;
            if(big.size() == maxSize)
                cbig += 1;
        }
        System.out.println("小值：" + clit);
        System.out.println("中值：" + cmid);
        System.out.println("大值：" + cbig);
        System.out.println("执行耗时：" + (new Date().getTime() - beginTime) + "ms");
    }

    public static void testSort(){
        int[] arrs = {1,4,55,9,44,34,57,2,54,12,45,777,32,193};

        for(int j = 0;j < arrs.length;j++){
            boolean notChange = true;
            for(int i = 0; i < arrs.length - 1 - j; i++){
                if(arrs[i] > arrs[i + 1]){
                    notChange = false;
                    int temp = arrs[i];
                    arrs[i] = arrs[i + 1];
                    arrs[i + 1] = temp;
                }
            }
            if(notChange)
                break;
        }

        for (int i = 0; i < arrs.length; i ++){
            System.out.print(arrs[i] + ",");
        }
    }



}
